const path = require('path');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');

module.exports = {
    mode:'development',
    entry:'./src/index.js',
    output:{
        path:path.resolve(__dirname,'./dist'),
        publicPath:'/dist/',
        filename:'vue-el-table.js',
        library:'vue-el-table',
        libraryTarget:'umd',
        libraryExport:'default',
        umdNamedDefine:true,
        globalObject:'typeof self !== \'undefined\' ? self : this'
    },
    module:{
        rules:[{
            test:/\.vue$/,
            loader:'vue-loader'
        },{
            test:/\.css$/,
            loader:'css-loader'
        },{
            test:/\.less$/,
            loader:'style-loader!css-loader!less-loader'
        },
        {
            test: /\.(png|jpg|gif|eot|woff|ttf|svg|webp|PNG)(\?\S*)?$/,
            use: ["file-loader"],
          },]
    },
    devtool:'source-map',
    resolve:{
        alias:{
            'vue':'vue/dist/vue.js',
            '@':path.join(__dirname, 'src')
        }
    },
    plugins:[
        new VueLoaderPlugin(),
        new CleanWebpackPlugin()
    ],
    // 排除打包库
    externals: {
        vue: 'Vue',
        'element-ui': 'ELEMENT'
    }
}